<!DOCTYPE html>
<html>
	<head lang="en">
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
		<meta name="format-detection" content="telephone=no">
		<meta name="renderer" content="webkit">
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		
		<title>注册</title>

		<link rel="stylesheet" href="../AmazeUI-2.4.2/assets/css/amazeui.min.css" />
		<link href="../css/dlstyle.css" rel="stylesheet" type="text/css">
		
		<script src="../AmazeUI-2.4.2/assets/js/jquery.min.js"></script>
		<script src="../AmazeUI-2.4.2/assets/js/amazeui.min.js"></script>
	</head>
	<body>
		@if(session('msg'))
		 	<script type="text/javascript">
		 		alert('恭喜您,注册成功');
		 		window.location.href="/doLogin";
		 	</script>
		 @endif
		<div class="login-boxtitle">
			<a href="home/homePage"><img alt="" src="../images/logobig.png" /></a>
		</div>
		<div class="res-banner">
			<div class="res-main">
				<div class="login-banner-bg"><span></span><img src="../images/big.jpg" /></div>
				<div class="login-box">	
					<div class="am-tabs" id="doc-my-tabs">
						<ul class="am-tabs-nav am-nav am-nav-tabs am-nav-justify">
							<li><a href="">注册</a></li>
						</ul>
						<div class="am-tabs-bd">
							<div class="am-tab-panel am-active">
									@if(count($errors)> 0)
										<div class='alert alert-danger'>
											<ul class="am-tabs-nav am-nav am-nav-tabs am-nav-justify">
												@foreach($errors->all() as $error)
													<li>
														{{ $error }}
													</li>														
												@endforeach
											</ul>
										</div>
									@endif
								<form method="post" action='{{ url("doregister") }}' id = 'myform'>
									{{ csrf_field() }}										
								   	<div class="user-email">
											<label for="email"><i class="am-icon-envelope-o"></i></label>
											<input type="email" name="email" id="email" placeholder="请输入邮箱账号">
	                 			  	</div>	
	                 			  	<span id='emailnotice'></span>
	                 			  	<div class="user-email">
										<label for="email"><i class="am-icon-user am-icon-fw"></i></label>
										<input type="text" name="username" id="username" placeholder="请输入用户名" onblur = 'chcek()' required>
	                 			  	</div>
	                 			  	<span id='namenotice'></span>											
	                 			   	<div class="user-pass">
									    <label for="password"><i class="am-icon-lock"></i></label>
									    <input type="password" name="userpwd" id="pass1" placeholder="设置密码" required>
	                 			    </div>		                 			   
	                 				<div class="user-pass">
									    <label for="passwordRepeat"><i class="am-icon-lock"></i></label>
									    <input type="password" name="repass" id="repass" placeholder="确认密码" required>
	                 				</div>	
	                 				<span id='passnotice'></span>                 
									<div class="am-cf">
										<input type="submit" name="" value="注册" class="am-btn am-btn-primary am-btn-sm am-fl" id = "send">
									</div>
									</div>
								</form>
							<script type="text/javascript" src='{{ asset("js/jquery-1.8.3.min.js") }}'></script>
							 <script>									
								$(function(){  
								   //文本框失去焦点后
								  $('form :input').blur(function(){
								    var parent = $(this).parent().next();
								    parent.find(".formtips").remove();
								    //验证用户名
								    if( $(this).is('#username') ){
								     if( this.value=="" || this.value.length < 6 ){
								      var errorMsg = '请输入至少6位的用户名.';
								      parent.append('<span class="formtips onError " style = "color:red;">'+errorMsg+'</span>');
								     }else{										      
								      parent.append('<span class="formtips onSuccess"></span>');
								     }
								    }
								    //验证密码是否一致
								    var pass = document.getElementById('pass1');
								    if( $(this).is('#repass') ){
								    	if(this.value != pass.value){
								    		var errorMsg = '两次输入密码不一致，请重新输入';
								    		parent.append('<span class="formtips onError" style = "color:red;">'+errorMsg+'</span>');
								    	}else{										    		
								      		parent.append('<span class="formtips onSuccess"></span>');
								    	}
								    }										    
								  }).keyup(function(){
								   $(this).triggerHandler("blur");
								  }).focus(function(){
								    $(this).triggerHandler("blur");
								  });										   
								  //提交，最终验证。
								   $('#send').click(function(){
								    $("form :input.required").trigger('blur');
								    var numError = $('form .onError').length;
								    if(numError){
								     return false;
								    }
								   });										 
								  //重置
								   $('#res').click(function(){
								    $(".formtips").remove(); 
								   });
								});
							</script>
						</div>
					</div>
				</div>
			</div>
		<div class="footer ">
			<div class="footer-hd ">
				<p>
					<a href="# ">关于我们</a>
					<b>|</b>
					<a href="# ">商城首页</a>
					<b>|</b>
					<a href="# ">支付宝</a>
					<b>|</b>
					<a href="# ">物流</a>
				</p>
			</div>
		</div>
	</body>
</html>